﻿/*****************************************************************************  

 Version: 0.1
 Website: http://www.visuagile.com/
 
 Copyright (c) Yoganand R. All rights reserved.
 For continued development and updates, visit http://yogsbreath.net
 
 ******************************************************************************/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VisualAgile.Model;

namespace VisualAgile.DTO.Mappers
{
    public class StatusDTOMapper:BaseDTOMapper
    {
        public static StatusDTO MapToDTO(Status model)
        {
            StatusDTO dto = new StatusDTO();
            IList<TaskDTO> taskDTO = new List<TaskDTO>();   

            dto.ID = model.StatusID;
            //dto.IterationID = model.IterationID;            
            dto.Name = model.Name;
            dto.CreateTime = model.CreateTime;
            dto.Creator = model.Creator;

            //load tasks
            foreach (Task task in model.Tasks)
            {
                taskDTO.Add(TaskDTOMapper.MapToDTO(task));
            }
            dto.items = taskDTO;

            return dto;
        }

        public static Status MapFromDTO(StatusDTO dto)
        {
            Status status = new Status();            
            status.StatusID = dto.ID;
            //Status.IterationID = dto.IterationID;            
            status.Name = dto.Name;
            status.CreateTime = dto.CreateTime;
            status.Creator = dto.Creator;
          
            return status;
        }
    }
}
 